package com.ruoyi.behindContractSH.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.behindContractSH.domain.DocContractSH;
import com.ruoyi.behindContractSH.service.IDocContractSHService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 签约审核Controller
 * 
 * @author ruoyi
 * @date 2025-08-16
 */
@RestController
@RequestMapping("/behindContractSH/BeDocContractSH")
public class DocContractControllerSH extends BaseController
{
    @Autowired
    private IDocContractSHService docContractService;

    /**
     * 查询签约审核列表
     */
    @PreAuthorize("@ss.hasPermi('behindContractSH:BeDocContractSH:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocContractSH docContract)
    {
        startPage();
        List<DocContractSH> list = docContractService.selectDocContractList(docContract);
        return getDataTable(list);
    }

    /**
     * 导出签约审核列表
     */
    @PreAuthorize("@ss.hasPermi('behindContractSH:BeDocContractSH:export')")
    @Log(title = "签约审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DocContractSH docContract)
    {
        List<DocContractSH> list = docContractService.selectDocContractList(docContract);
        ExcelUtil<DocContractSH> util = new ExcelUtil<DocContractSH>(DocContractSH.class);
        util.exportExcel(response, list, "签约审核数据");
    }

    /**
     * 获取签约审核详细信息
     */
    @PreAuthorize("@ss.hasPermi('behindContractSH:BeDocContractSH:query')")
    @GetMapping(value = "/{contractId}")
    public AjaxResult getInfo(@PathVariable("contractId") Long contractId)
    {
        return success(docContractService.selectDocContractByContractId(contractId));
    }

    /**
     * 新增签约审核
     */
    @PreAuthorize("@ss.hasPermi('behindContractSH:BeDocContractSH:add')")
    @Log(title = "签约审核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocContractSH docContract)
    {
        return toAjax(docContractService.insertDocContract(docContract));
    }

    /**
     * 修改签约审核
     */
    @PreAuthorize("@ss.hasPermi('behindContractSH:BeDocContractSH:edit')")
    @Log(title = "签约审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocContractSH docContract)
    {
        return toAjax(docContractService.updateDocContract(docContract));
    }

    /**
     * 删除签约审核
     */
    @PreAuthorize("@ss.hasPermi('behindContractSH:BeDocContractSH:remove')")
    @Log(title = "签约审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{contractIds}")
    public AjaxResult remove(@PathVariable Long[] contractIds)
    {
        return toAjax(docContractService.deleteDocContractByContractIds(contractIds));
    }
}
